import xmlrpclib
from Pickles import *
from InterfaceBaseDonnees import *

class Serveur(object):
    def __init__(self):
        self.serveur = xmlrpclib.ServerProxy('http://localhost:8000')
        self.BaseDonnees = InterfaceBaseDonnees("Client", self.serveur)

Serveur = Serveur()
<<<<<<< .mine


=======

Age = Champ("Age", "NUMBER",2,None )
Taille = Champ("Taille", "NUMBER",3,2 ) 
Nom = Champ("Nom", "VARCHAR2",30,None ) 
Anniversaire = Champ("Anniversaire", "Date",None,None ) 
ListeChamps = (Age, Taille, Nom, Anniversaire)
Perp_Member = Table("PERPMEMBER", ListeChamps)
Message = Serveur.BaseDonnees.CreerTable("test")


>>>>>>> .r79
#Age = Champ("Age", "NUMBER",str(2),None )
#Taille = Champ("Taille", "NUMBER",str(3),str(2)) 
#Nom = Champ("Nom", "VARCHAR2",str(30),None) 
#Anniversaire = Champ("Anniversaire", "Date",None,None ) 
#ListeChamps = (Age, Taille, Nom, Anniversaire)
#Emp = Table("Emp2", ListeChamps)
#Message = Serveur.BaseDonnees.CreerTable(Emp)
#print Message[1]
#
#

#Message = Serveur.BaseDonnees.ObtenirTable()
#print Message[1]
#Message = Serveur.BaseDonnees.ObtenirChamp("Emp")
#if Message[0] == 1:
#    for UnChamp in Message[1].Champs:
#        print UnChamp.Nom, UnChamp.Type, UnChamp.Taille, UnChamp.Precision
#
#
Age = ChampDonnee("AGE", "15")
Taille = ChampDonnee("TAILLE", "1.3" ) 
Nom = ChampDonnee("NOM", "'Marc Vendette'") 
ListeChamps = (Age, Taille, Nom)
Emp = Table("Emp2", ListeChamps)
Message = Serveur.BaseDonnees.EntrerEnregistrement(Emp)
print Message[1]
Message = Serveur.BaseDonnees.Commit()
print Message[1]

<<<<<<< .mine
#ListeNomsChamps = ("Age", "Taille", "Nom")
#LaTable = Table("Emp2", ListeNomsChamps)
#Message = Serveur.BaseDonnees.ObtenirEnregistrement(LaTable)
#if Message[0] == 1:
#   for UnChamp in Message[1].Champs:
#        print UnChamp.Nom, UnChamp.Valeur=======
ListeNomsChamps = ("Age", "Taille", "Nom")
LaTable = Table("Emp2", ListeNomsChamps)
Message = Serveur.BaseDonnees.ObtenirEnregistrement(LaTable)
if Message[0] == 1:
    LaTable = Message[1]
    for UnChamp in LaTable.Champs:
            print UnChamp.Nom, UnChamp.Type, UnChamp.Taille , UnChamp.Precision
else:
    print Message[1]
for UnChamp in Message[1].Champs:
    for UneValeur in UnChamp:
        print UneValeur
>>>>>>> .r79
